package cn.iocoder.yudao.module.train.dal.mysql.teaching;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.train.dal.dataobject.teaching.TeachingDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.train.controller.admin.teaching.vo.*;

/**
 * 授课管理 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface TeachingMapper extends BaseMapperX<TeachingDO> {

    default PageResult<TeachingDO> selectPage(TeachingPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TeachingDO>()
                .likeIfPresent(TeachingDO::getCommodityName, reqVO.getCommodityName())
                .likeIfPresent(TeachingDO::getGroupName, reqVO.getGroupName())
                .likeIfPresent(TeachingDO::getTeacherName, reqVO.getTeacherName())
                .eqIfPresent(TeachingDO::getStudentQuantity, reqVO.getStudentQuantity())
                .betweenIfPresent(TeachingDO::getRemainderCourseTime, reqVO.getRemainderCourseTime())
                .betweenIfPresent(TeachingDO::getAllCourseTime, reqVO.getAllCourseTime())
                .eqIfPresent(TeachingDO::getCommodityStatus, reqVO.getCommodityStatus())
                .betweenIfPresent(TeachingDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TeachingDO::getId));
    }

}